﻿// Decompiled with JetBrains decompiler
// Type: DnProcessSimulateCommands.ExportToRTR.CApExportToRTRDevicesExporter
// Assembly: DnProcessSimulateCommands, Version=2402.0.0.890, Culture=neutral, PublicKeyToken=null
// MVID: A885D881-AEDF-447E-852A-6F13102E089C
// Assembly location: C:\Program Files\Tecnomatix_2402\eMPower\DotNetCommands\DnProcessSimulateCommands.dll

using System;
using System.Collections.Generic;
using System.Linq;
using Tecnomatix.Engineering;


namespace DnProcessSimulateCommands.ExportToRTR{

public class CApExportToRTRDevicesExporter : CApExportToRTRCollectionExporter<ITxDevice>
{
  private const string DYNAMIC_SCENE = "dynamic_scene";

  public override void Export(CApExportToRTRXmlWriter writer, string path, string worldLink)
  {
    if (this.Objects.Count <= 0)
      return;
    foreach (ITxDevice device in this.Objects)
    {
      if (device is ITxTool)
        ((IEnumerable<ITxObject>) (device as ITxTool).NonCollidingEntities).ToList<ITxObject>().ForEach((Action<ITxObject>) (x => (x as ITxDisplayableObject).Blank()));
      CApExportToRTRDevice exportToRtrDevice = new CApExportToRTRDevice(device, path, "dynamic_scene");
      exportToRtrDevice.Write(writer);
      this.Exported3D.UnionWith((IEnumerable<ITxObject>) exportToRtrDevice.Static3D);
      if (device is ITxTool)
        ((IEnumerable<ITxObject>) (device as ITxTool).NonCollidingEntities).ToList<ITxObject>().ForEach((Action<ITxObject>) (x => (x as ITxDisplayableObject).Display()));
    }
  }
}
